package Calendar类编程题;

import java.util.Calendar;

public class DaysAfterNow {
    public static void printDate(Calendar calendar){
        System.out.println("年:"+calendar.get(Calendar.YEAR)+" "+"月: "+calendar.get(Calendar.MONTH)+" "+"日: "+calendar.get(Calendar.DAY_OF_MONTH));
    }
    public static void main(String[] args) {
        Calendar calendarAdd = Calendar.getInstance();
        Calendar calendarSub = Calendar.getInstance();
        DaysAfterNow.printDate(calendarAdd);
        calendarAdd.add(Calendar.DAY_OF_YEAR,100);
        calendarSub.add(Calendar.DAY_OF_YEAR,-100);
        DaysAfterNow.printDate(calendarAdd);
        DaysAfterNow.printDate(calendarSub);
    }
}
